/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.matrimonybeans;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;

/**
 *
 * @author hb
 */
@Stateless
public class Add_ChargesForregistra implements Add_ChargesForregistraLocal {

    Connection conn;
    boolean flag = false;

    @Override
    public Boolean Add_ChargesForRegistration_data(String duration, BigDecimal price) {
        try {
            ConnectDB conDB = new ConnectDB();
            conn = conDB.getConnection();
            String strSql = "Insert into Charges(duration,price) values(?,?)";
            PreparedStatement pstmt = conn.prepareStatement(strSql);
            pstmt.setString(1, duration);
            pstmt.setBigDecimal(2, price);
            
            //ResultSet rs = pstmt.executeQuery();
            int count = 0;
            count = pstmt.executeUpdate();
            if (count > 0) {
                flag = true;
            } else {
                flag = false;
            }
            


        } catch (SQLException ex) {
            Logger.getLogger(Add_ChargesForregistra.class.getName()).log(Level.SEVERE, null, ex);
        }
        return flag;
    }
}
